# Generated by Django 2.2.9 on 2020-03-02 11:01

import django.core.validators
import django.db.models.deletion
import simple_history.models
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):
    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ("challenge", "0054_auto_20200114_1819"),
    ]

    operations = [
        migrations.CreateModel(
            name="HistoricalAnnualStateSetting",
            fields=[
                (
                    "id",
                    models.IntegerField(
                        auto_created=True, blank=True, db_index=True, verbose_name="ID"
                    ),
                ),
                ("canton", models.CharField(max_length=2, verbose_name="Canton")),
                ("year", models.PositiveSmallIntegerField(verbose_name="Année")),
                (
                    "cost_per_bike",
                    models.DecimalField(
                        decimal_places=2,
                        default=0,
                        help_text="CHF",
                        max_digits=8,
                        validators=[django.core.validators.MinValueValidator(0)],
                        verbose_name="Coût par vélo",
                    ),
                ),
                (
                    "cost_per_participant",
                    models.DecimalField(
                        decimal_places=2,
                        default=0,
                        help_text="CHF",
                        max_digits=8,
                        validators=[django.core.validators.MinValueValidator(0)],
                        verbose_name="Coût par participant",
                    ),
                ),
                ("history_id", models.AutoField(primary_key=True, serialize=False)),
                ("history_date", models.DateTimeField()),
                ("history_change_reason", models.CharField(max_length=100, null=True)),
                (
                    "history_type",
                    models.CharField(
                        choices=[("+", "Created"), ("~", "Changed"), ("-", "Deleted")],
                        max_length=1,
                    ),
                ),
                (
                    "history_user",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "verbose_name": "historical Configuration cantonale par année",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": "history_date",
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name="AnnualStateSetting",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("canton", models.CharField(max_length=2, verbose_name="Canton")),
                ("year", models.PositiveSmallIntegerField(verbose_name="Année")),
                (
                    "cost_per_bike",
                    models.DecimalField(
                        decimal_places=2,
                        default=0,
                        help_text="CHF",
                        max_digits=8,
                        validators=[django.core.validators.MinValueValidator(0)],
                        verbose_name="Coût par vélo",
                    ),
                ),
                (
                    "cost_per_participant",
                    models.DecimalField(
                        decimal_places=2,
                        default=0,
                        help_text="CHF",
                        max_digits=8,
                        validators=[django.core.validators.MinValueValidator(0)],
                        verbose_name="Coût par participant",
                    ),
                ),
            ],
            options={
                "verbose_name": "Configuration cantonale par année",
                "verbose_name_plural": "Configurations cantonales par année",
                "unique_together": {("canton", "year")},
            },
        ),
    ]
